<?php

class Wlib_Form_Decorator_ViewImage extends Zend_Form_Decorator_Abstract
{
    public function render($content)
    {
       $view = $this->getElement()->getView();
       $imagePreviewPath = $view->imageResizer(array(
            'file'=> $this->getOption('source'),
            'sizex' => $this->getOption('sizeX'),
            'sizey' => $this->getOption('sizeY'),
            'newpath' => $this->getOption('location')
       ));

       if($imagePreviewPath) {
           return '<img src="/' . $imagePreviewPath .  '">' . $content;
       } else {
           return $content;
       }
    }
}
